<script setup lang='ts'>
import type { UserInfo } from '../../../store/'
import { useUserStore } from '../../../store/'
const props = defineProps<{ userInfo: UserInfo }>()

const store = useUserStore()

</script>
<template>
    <div class="user-box">
        <div class="face-content">
        </div>
        <div class="nick-name-box">{{ props.userInfo.name }}</div>
        <div class="coins-box">
            <div class="coins"><span>硬币</span>：{{ props.userInfo.coins }}</div>
            <div class="b-coins"><span>B币：</span>{{ props.userInfo.bCoins }}</div>
        </div>
        <div class="lv-box">
            <span class="left-lv iconfont" :class="`icon-level_${props.userInfo.lv}`"></span>
            <div class="ex-box">
                <div class="current-ex" :style="`width:${store.getResidualExPe}%`"></div>
            </div>
            <span class="right-lv iconfont"
                :class="`icon-level_${(props.userInfo.lv + 1) > 6 ? 'max' : (props.userInfo.lv + 1)}`">
            </span>
        </div>
        <div class="ex-desc-box">
            当前成长{{ props.userInfo.ex }},距离升级lv{{ props.userInfo.lv + 1 }}还需要{{ store.getResidualEx }}
        </div>
        <div class="counts-box">
            <div class="single-item">
                <div class="num">{{ props.userInfo.sub }}</div>
                <div class="title">关注</div>
            </div>
            <div class="single-item">
                <div class="num">{{ props.userInfo.fans }}</div>
                <div class="title">粉丝</div>
            </div>
            <div class="single-item">
                <div class="num">{{ props.userInfo.trends }}</div>
                <div class="title">动态</div>
            </div>
        </div>
        <ul class="btn-list">
            <li class="btn-item">
                <div>
                    <span class="iconfont icon-collection left-icon"></span>
                    <span class="btn-text">个人中心</span>
                </div>
                <span>></span>
            </li>
            <li class="btn-item">
                <div>
                    <span class="iconfont icon-collection left-icon"></span>
                    <span class="btn-text">投稿管理</span>
                </div>
                <span>></span>
            </li>
            <li class="btn-item">
                <div>
                    <span class="iconfont icon-collection left-icon"></span>
                    <span class="btn-text">推荐服务</span>
                </div>
                <span>></span>
            </li>
        </ul>
        <div class="logout-btn">
            <span class="iconfont icon-collection left-icon"></span>
            <span class="btn-text">退出登录</span>
        </div>
    </div>
</template>
<style lang='less' scoped>
.user-box {
    width: 300px;
    padding: 0 24px 18px;
    color: #000;
    box-sizing: border-box;
    position: relative;

    .face-content {
        width: 80px;
        height: 80px;
    }

    .nick-name-box {
        font-size: 18px;
        color: #000;
        text-align: center;
        margin-top: -40px;
        margin-bottom: 10px;
    }

    .coins-box {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 12px;
        margin-bottom: 10px;

        span {
            color: var(--text3);
        }

        .coins {
            margin-right: 10px;
        }
    }

    .lv-box {
        display: flex;
        justify-content: center;
        align-items: center;

        .right-lv,
        .left-lv {
            &::before {
                font-size: 24px !important;
            }
        }

        .ex-box {
            flex: 1;
            height: 1px;
            background-color: #ccc;
            margin: 0 5px;

            .current-ex {
                background-color: orange;
                height: 100%;
            }
        }

        .right-lv {
            &::before {
                color: #ccc !important;
            }
        }
    }

    .ex-desc-box {
        font-size: 12px;
        color: var(--text3);
        text-align: center;
        margin-bottom: 20px;
    }

    .counts-box {
        display: flex;
        padding: 0 20px;
        justify-content: space-between;
        margin-bottom: 25px;

        .single-item {
            display: flex;
            flex-direction: column;
            align-items: center;

            .title {
                font-size: 12px;
                color: var(--text3);
            }

            .num {
                font-size: 18px;
                color: #000
            }

            &:hover {

                & .title,
                & .num {
                    color: skyblue !important
                }
            }
        }
    }

    .btn-list {

        .btn-item {
            display: flex;
            padding: 10px 20px;
            justify-content: space-between;
            align-items: center;
            font-size: 14px;
            line-height: 24px;
            color: #61666d;

            .left-icon {
                font-size: 18px !important;
                margin-right: 30px;
            }
        }
    }

    .logout-btn {
        display: flex;
        padding: 15px 20px;
        margin-top: 10px;
        align-items: center;
        font-size: 14px;
        line-height: 24px;
        color: #61666d;
        border-top: 1px solid var(--line_regular);

        .left-icon {
            font-size: 18px !important;
            margin-right: 30px;
        }
    }
}
</style>